package com.xudu.zerocodebackend.controller;

import com.qcloud.cos.COSClient;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.sts.v20180813.StsClient;
import com.tencentcloudapi.sts.v20180813.models.*;
import com.xudu.zerocodebackend.common.BaseResponse;
import com.xudu.zerocodebackend.common.ResultUtils;
import com.xudu.zerocodebackend.config.CosClientConfig;
import com.xudu.zerocodebackend.manager.CosManager;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @className: CosController
 * @description: TODO
 * @author: xudu
 * @create: 2025-07-28
 */
@RestController
@RequestMapping("/cos")
public class CosController {


    @Resource
    private CosManager cosManager;



    @GetMapping("/get/sts")
    public BaseResponse<Map<String, Object>> getSts(String filename) throws Exception {
        return ResultUtils.success(cosManager.getTemporaryCredentials(filename));
    }


}
